$(function () {
  $('.signout').click(function () {
    $('.signout-layer').show()
  })

  $('.btn-cancel').click(function () {
    $('.signout-layer').hide()
  })

  // 提交表单
  $('.submit-btn').click(function () {
    var formData = $('#form').serializeArray().reduce(function (prev, next) {
      prev[next.name] = next.value
      return prev
    }, {})

    if (formData.oldPassword === '') {
      wu.showMessage({
        title: "请输入旧密码",
        backgroundColor: '#ff4d4f',
        duration: 2500
      });
      return
    }

    if (formData.password === '') {
      wu.showMessage({
        title: "请输入新密码",
        backgroundColor: '#ff4d4f',
        duration: 2500
      });
      return
    }

    if (formData.confirmPassword === '') {
      wu.showMessage({
        title: "请再次输入新密码",
        backgroundColor: '#ff4d4f',
        duration: 2500
      });
      return
    }

    if (formData.password !== formData.confirmPassword) {
      wu.showMessage({
        title: "新密码与确认密码输入不一致，请检查",
        backgroundColor: '#ff4d4f',
        duration: 2500
      });
    }

    // noinspection JSAnnotator
    // alert(`用户名：${formData.username}  密码：${formData.password}`)
  })
})